package com.dynamixsoftware.printershare;

import android.content.ContentResolver;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.provider.CallLog.Calls;
import android.widget.Toast;

public class ActivityPrintCallLog
  extends ActivityPrintText
{
  private ActivityPrintContacts.Impl impl = ActivityPrintContacts.Impl.getImpl();
  Bitmap itp;
  Bitmap mtp;
  Bitmap otp;
  
  protected void createPages()
  {
    initPage();
    Cursor localCursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, new String[] { "number", "date", "type", "duration", "name", "numberlabel", "numbertype" }, null, null, "date DESC");
    int i = -1;
    while ((i < 0) || (localCursor.moveToNext()))
    {
      newPage();
      if (i == -1)
      {
        i++;
      }
      else
      {
        String str1 = localCursor.getString(0);
        if ((str1 == null) || ("-1".equals(str1))) {
          str1 = "(unknown)";
        }
        if ("-2".equals(str1)) {
          str1 = "(private)";
        }
        if ("-3".equals(str1)) {
          str1 = "(payphone)";
        }
        long l = localCursor.getLong(1);
        int j = localCursor.getInt(2);
        int k = localCursor.getInt(3);
        String str2 = localCursor.getString(4);
        Bitmap localBitmap = null;
        switch (j)
        {
        }
        for (;;)
        {
          if (!needNew(20, 210)) {
            break label313;
          }
          localCursor.moveToPrevious();
          break;
          if (this.itp == null) {
            this.itp = BitmapFactory.decodeResource(getResources(), 2130837526);
          }
          localBitmap = this.itp;
          continue;
          if (this.mtp == null) {
            this.mtp = BitmapFactory.decodeResource(getResources(), 2130837527);
          }
          localBitmap = this.mtp;
          continue;
          if (this.otp == null) {
            this.otp = BitmapFactory.decodeResource(getResources(), 2130837528);
          }
          localBitmap = this.otp;
        }
        label313:
        Paint localPaint1 = App.newPaint();
        if (localBitmap != null)
        {
          Canvas localCanvas = this.canvas;
          Rect localRect1 = new Rect(0, 0, localBitmap.getWidth(), localBitmap.getHeight());
          Rect localRect2 = new Rect(0, 0, (int)(50.0F * this.fontSizeCoef), (int)(50.0F * this.fontSizeCoef));
          localCanvas.drawBitmap(localBitmap, localRect1, localRect2, localPaint1);
        }
        Paint localPaint2 = App.newPaint();
        localPaint2.setStyle(Paint.Style.FILL);
        localPaint2.setColor(-16777216);
        if (str2 != null) {}
        for (String str3 = str2;; str3 = str1)
        {
          printText(str3, 70, false, 0.0F, 75, 45, 70, localPaint2);
          if (str2 != null) {
            printText((this.impl.getPhoneTypeLabel(this, localCursor.getInt(6), localCursor.getString(5)).toString().trim() + " " + str1).trim(), 45, false, 0.0F, 75, 25, 45, localPaint2);
          }
          printText(App.formatTimeStampString(this, l, true), 40, false, 0.0F, 75, 25, 45, localPaint2);
          if (j == 3) {
            break;
          }
          printText(k / 60 + " mins " + k % 60 + " secs", 40, false, 0.0F, 75, 25, 45, localPaint2);
          break;
        }
      }
    }
    addPage();
    localCursor.close();
    if (i == 0) {
      runOnUiThread(new Runnable()
      {
        public void run()
        {
          Toast.makeText(ActivityPrintCallLog.this, 2131099687, 1).show();
        }
      });
    }
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.ActivityPrintCallLog
 * JD-Core Version:    0.7.0.1
 */